A network device, such as a firewall, is a device that acts as an interface between a network and one or more external devices and/or networks. A firewall implements a security policy of a network by determining which traffic (e.g., packets) to let pass through and which traffic to block, based on a set of rules defined by a network administrator. Any error in defining the rules may compromise network security by letting undesired traffic pass through or by blocking desired traffic. The firewall rules, when defined manually, often result in a set that contains conflicting, redundant, or overshadowed firewall rules, which creates anomalies in the firewall policy.